import { Rule, RuleType } from "@midwayjs/validate";
import { PageDTO } from "@dto/common/page.dto";

// 查询参数
export class ListDictDataDTO extends PageDTO {
  @Rule(RuleType.string().required())
  dictType: string;

  @Rule(RuleType.string())
  dictLabel?: string;

  @Rule(RuleType.string())
  status?: string;

  @Rule(RuleType.string())
  'params[beginTime]'?: string;

  @Rule(RuleType.string())
  'params[endTime]'?: string;
}

// 新增参数
export class CreateDictDataDTO {
  @Rule(RuleType.string().required())
  dictLabel: string;

  @Rule(RuleType.string().required())
  dictValue: string;

  @Rule(RuleType.string().required())
  dictType: string;

  @Rule(RuleType.string().allow(null, ""))
  cssClass?: string;

  @Rule(RuleType.string().required())
  listClass: string;

  @Rule(RuleType.string().required())
  isDefault: string;

  @Rule(RuleType.number().required().min(0))
  dictSort: number;

  @Rule(RuleType.string())
  status?: string;

  @Rule(RuleType.string().max(500).allow(null, ""))
  remark?: string;
}

// 修改参数
export class UpdateDictDataDTO extends CreateDictDataDTO{
  @Rule(RuleType.number().required())
  dictCode: number;
}
